﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting.Messaging;

namespace ForumServer.Forum
{
    public class Forum : MarshalByRefObject
    {
        private string          _topic;
        private string          _URL;
        private List<Thread>    _threadList;

        public string Topic { get { return _topic; } }
        public string URL { get { return _URL; } set { _URL = value; } }
        public List<Thread> ThreadList { get { return _threadList; } }
        
        public Forum(string topic, string url)
        {
            _topic = topic;
            _URL = url;
            _threadList = new List<Thread>();
        }
        /// <summary>
        /// add thread to the forum list
        /// </summary>
        /// <param name="t"> the thread to add </param>
        public void addThread(Thread t)
        {
            _threadList.Add(t);
        }

        public void removeAt(int index)
        {
            if (index < 0 || index >= _threadList.Count)
                return;
            _threadList.RemoveAt(index);
        }
        /// <summary>
        /// the ToString Methed.
        /// </summary>
        /// <returns></returns>
        public override string ToString(){
            return this._topic;
        }

        

        
    }
}
